{% extends "forms-side.html" %}

{% load forms common %}

{% block extrahead %}
{{ form.media }}
{% endblock %}

{% block title %}OS Group {{ osgroup }} {% endblock %}

{% block content_title %}OS Group Information{% endblock %}

{% block breadcrumbs %}{{ block.super }} &rsaquo; <a href="{% url 'os_list' %}">Operating Systems</a> &rsaquo; <a href="{% url 'osgroup_list' %}">Groups</a> &rsaquo; {{ osgroup }} {% endblock %}

{% block content %}

<div class="module">
    <h2>{{ osgroup }} Details</h2>
    <table>
        <tr>
            <td>Name</td><td> {{ osgroup.name }} </td>
        </tr>
    </table>
</div>

<div class="module">
    <h2>Operating Systems linked to OS Group {{ osgroup }}</h2>
    <table>
        <thead>
        <tr>
            <th>OS Name</th>
        </tr>
        </thead>
        {% for repo in osgroup.os_set.select_related %}
        <tr class="{% cycle 'row1' 'row2' %}">
            <td><a href="{{ repo.get_absolute_url }}">{{ repo }}</a></td>
        </tr>
        {% endfor %}
    </table>
</div>

{% if user.is_authenticated %}
  {% if perms.is_admin %}
  <div class="module">
    <h2>Delete Confirmation</h2>
    <div class="dialog">
      Are you sure you want to delete this OS Group? This will also any linked Operating Systems.
      <form action="." method="POST">
        {% csrf_token %}
        <input name="delete" type="submit" value="Delete" />
        <input name="cancel" type="submit" value="Cancel" />
      </form>
    </div>
  </div>
  {% else %}
  <div class="module">
    <h2>Insufficient Permissions</h2>
    <div class="brick">
    You do not have sufficient permissions to delete this OS Group.
    </div>
  </div>
  {% endif %}
{% endif %}

{% endblock %}
